package com.example.myapplication.activity.base_activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.myapplication.R;
import com.example.myapplication.utils.Utils;


public class ViewBorderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_border);
        TextView textView = findViewById(R.id.layoutHG);
        //获取布局参数
        ViewGroup.LayoutParams layoutParams = textView.getLayoutParams();
        // 修改布局参数中的宽度数值，注意默认px单位，需要把dp数值转成px数值
        layoutParams.width= Utils.dip2px(this,300);
        //设置布局参数
        textView.setLayoutParams(layoutParams);

    }
}